package com.liit.module.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.liit.module.dao.RetailAreaDao;
import com.liit.module.entity.RetailArea;
import com.liit.module.frame.utils.page.Pagination;
import com.liit.module.service.RetailAreaService;

/**
 * @author dingweibo
 * @Title: RetailAreaServiceImpl.java
 * @Description: 城市或地区维护服务实现
 * @date 2015年12月22日
 */
@Service("retailAreaService")
public class RetailAreaServiceImpl implements RetailAreaService {

	@Autowired
	RetailAreaDao retailAreaDao;

	@Override
	public int deleteById(Integer id) {
		return retailAreaDao.deleteById(id);
	}

	@Override
	public int insertAndReturnPK(RetailArea record) {
		retailAreaDao.insert(record);
		return record.getId();
	}

	@Override
	public RetailArea selectById(Integer id) {
		return retailAreaDao.selectById(id);
	}

	@Override
	public int updateById(RetailArea record) {
		return retailAreaDao.updateById(record);
	}

	@Override
	public Map<String, Object> listPage(Pagination pagination, RetailArea record) {
		Map<String, Object> result = new HashMap<String, Object>();
		result.put("list", retailAreaDao.listPage(pagination, record));
		result.put("page", pagination);
		return result;
	}

	@Override
	public List<RetailArea> selectAreaByRegion(Integer region, Integer disabled) {
		return retailAreaDao.selectAreaByRegion(region, disabled);
	}

}
